<?php

namespace app\model;


use think\model\relation\HasMany;

/**
 * @property integer $id 主键(主键)
 * @property integer $factory_id 所属工厂ID
 * @property string $cn_name 名称
 * @property string $details 详情
 * @property string $created_at 创建时间
 * @property string $updated_at 更新时间
 * @property string $deleted_at 删除时间
 * @property string $need_coin 需要金币
 * @property integer $need_lv 需要等级
 * @property integer $need_time 需要时间
 * @property integer $build_time 建造需要时间
 * @property integer $num 生产数量
 */
class Material extends Base
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'wa_material';

    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'id';


    public function ingredients(): \think\model\relation\HasOne
    {
        return $this->hasOne(FactoryIngredient::class,'id','ingredients_id');
    }


    public function factoryBuildMaterial(): HasMany
    {
        return $this->hasMany(FactoryBuildMaterial::class,'material_id','id')->hidden(['created_at','updated_at','deleted_at','id','material_id']);
    }

    
    
    
}
